home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
H-I
/
HyperHackers.cpt
/
Hyper-Hackers Queue 1.0
/
card_20270.txt
< prev
next >
Wrap
Text File
|
1989-02-26
|
3KB
|
71 lines
-- card: 20270 from stack: in.0
-- bmap block id: 0
-- flags: 0000
-- background id: 3797
-- name:
-- part contents for background part 1
----- text -----
From: winkler@Apple.COM (Dan Winkler)
Date: 29 Feb 88 16:45:09 GMT
There is no constant in HyperTalk named "newline", only "return"
and "linefeed". When you write:
read from file f until newline
you are not providing a valid expression after the "until". So, in a
never ending battle to figure out what the heck you meant, the
HyperTalk interpreter guesses that you might forgotten a pair of
quotes, and transforms the line into:
read from file f until "newline"
Having thus succeeded in wrenching the line into something syntactically
correct, the interpreter passes control to the read command. The read
command then does its job, which is to read up to the first character
of the until string, namely "n". (The reason that read only reads up
to the first character, is that that is all the underlying Macintosh
file system has built in.)
I call the above construction an "unquoted literal". It let's you
do things like
get field fred instead of get field "fred"
go to clip art instead of go to "clip art"
Unfortunately, I'm still the only person in the world who knows many
secrets of HyperTalk, such as exactly where unquoted literals are
allowed, where they're not, where they are restricted to single tokens,
and where they can be multiple tokens. Here are a couple rules of
thumb:
1. Unquoted literals are not allowed as sources in an expression.
(I could have allowed them, but that would be REALLY dangerous.)
put "hello" && "there" - quotes are required
2. Unquoted literals can only be a single token except for stack names.
This is because once I decide to take more than one token as unquoted,
I never know where to stop and so go all the way to the end of the line.
Stack names are the only thing that occur at the end of the line often
enough to make this worth it.
go to stack "clip art" - quotes are optional
put field "clip art" into it - quotes are required
Unquoted literals exist only for lazy typists and forgetful beginners.
If you can at all manage to supply the quotes, it's much better that
way, mainly because statements that use unquoted literals can suddenly
begin to behave differently if you ever define a variable with the same
name as the unquoted literal. Fortunately, only the handler can define
things in its scope, but it's still dangerous.
-- part contents for background part 45
----- text -----
Re: HyperCard bug  <- No, it's a feature.